<template>
  <router-link :to="'/packageDetail/' + data.package_id"  class="card" :class="{'gridCard': !type}">
    <div class="left">
      <img class="packageImage" :src="data.package_img" alt="" v-imgField/>
    </div>
    <div class="right">
      <p class="packageName">
        <package-tag :data="data"></package-tag>
        {{ data.package_title }}</p>
      <p class="packagePriceSale">

        <span class="packagePrice">
          <em>￥</em>{{ data.package_price.toFixed(2) }}
        </span>
        <span class="packageSalenum">已售出{{data.salesnum}}</span>
      </p>
    </div>
  </router-link>
</template>

<script>
import packageTag from '@comps/tag/packageTag'

export default {
  props: {
    data: {},
    type: true
  },
  components: {
    packageTag
  }
}
</script>

<style lang="scss" scoped>
  @import "../../../assets/css/pub";

  .card {
    padding: .25rem;
    display: flex;
    background-color: #fff;

    .left {
      width: 3.5rem;
      height: 1.75rem;
      flex: none;

      .packageImage {
        width: 100%;
        height: 100%;
        padding: 0;
        border-radius: .125rem;
      }
    }

    .right {
      padding-left: .25rem;
      width: 100%;
      height: 1.75rem;
      .packageName {
        font-size: $default_font_size;
        color: $default_title_color;
        height: 1rem;
        line-height: .5rem;
        @include textHideByLine(2);

      }
      .packagePriceSale {
        margin-top: .25rem;
        height: .5rem;
        line-height: .5rem;
        .packagePrice {
          font-size: $default_bigfont_size;
          color: $default_price_color;
          overflow: visible;
          em {
            font-size: $default_smallfont_size;
            font-style: normal;
          }
        }
        .packageSalenum {
          color: $default_subtitle_color;
          float: right;
          font-size: $default_middlefont_size;
        }
      }
    }
  }

  .gridCard {
    display: inline-block;
    width: 4.5625rem;
    height: 4.5rem;
    padding: .25rem;
    box-sizing: border-box;
    flex-direction: column;
    .left {
      width: 4.0625rem;
      height: 2.03125rem;
    }
    .right {
      width: 4.0625rem;
      padding-left: 0;
      padding-top: .25rem;
    }
    &:nth-child(2n) {
      margin-left: .25rem;
    }
  }

</style>
